home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / m68k / 543 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: tribune.usask.ca!usenet
  2. From: eric@skatter.USask.Ca
  3. Newsgroups: comp.sys.m68k
  4. Subject: MC68360 16-bit SPI problems
  5. Date: 9 Apr 1996 18:15:20 GMT
  6. Organization: University of Saskatchewan
  7. Message-ID: <4ke9fo$jvp@tribune.usask.ca>
  8. NNTP-Posting-Host: pisces.usask.ca
  9. X-Newsreader: Alexandra.app (Version 0.81)
  10.  
  11. I'm using the SPI interface to transfer blocks of data between some equipment 
  12. and an MC68EN360.  Here's the way I have things set up now:
  13.  
  14. 1) MOT bit (bit 4) set in SPI transmit and receive function code registers.
  15. 2) REV bit (bit 10) set in SPI mode register (most significant bit first).
  16. 3) LEN field in SPI mode register set to 7 (i.e. 8-bit characters).
  17.  
  18. As an example of how this transfers data, consider the following two bytes in 
  19. memory.  I've given each of the bits a letter for easy reference -- bit a is 
  20. the most significant bit of location 0, bit n is the least significant bit of 
  21. location 1.
  22.  
  23.                +---+---+---+---+---+---+---+
  24. Location 0:    | a | b | c | d | e | f | g |
  25.                +---+---+---+---+---+---+---+
  26.                +---+---+---+---+---+---+---+
  27. Location 1:    | h | i | j | k | l | m | n |
  28.                +---+---+---+---+---+---+---+
  29.  
  30. If these two bytes are transmitted with the above SPI configuration, the bits 
  31. would appear on the wire with bit a first, bit b second and so on:
  32.     FIRST                         LAST
  33.         a b c d e f g h i j k l m n 
  34.  
  35. This method of transferring data may place too high a load on the 
  36. communication controller inside the 68360.  I decided to reduce the load byt 
  37. doing the transfers 16-bits at a time.  I changed the LEN field in the SPI 
  38. mode register from 7 to 15.
  39.  
  40. Now, the bits are transmitted in the following order:
  41.     FIRST                         LAST
  42.         h i j k l m n a b c d e f g 
  43.  
  44. It seems that the Least Significant Byte of the 16-bit word is being 
  45. transferred first.  I had expected that the bits would appear on the wire 
  46. just as they had in the 8-bit case!  
  47.  
  48. Am I going to have to byte-swap all my data before sending it to, and after 
  49. receiving it from, the SPI interface? (!!!)  Or is there some configuration 
  50. detail that I've missed?
  51.  
  52. Is the above behaviour the same in all revisions of the 68360?
  53.  
  54. -- 
  55. Eric Norum                                 eric@skatter.usask.ca
  56. Saskatchewan Accelerator Laboratory        Phone: (306) 966-6308
  57. University of Saskatchewan                 FAX:   (306) 966-6058
  58. Saskatoon, Canada.                         NeXTMail accepted.
  59.